package com.itheima.reggie.dao;

import com.itheima.reggie.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

public interface UserDao {

    // 根据手机号查找用户
    @Select("select * from user where phone= #{phone}")
    User findByPhone(String phone);

    // 保存用户
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    @Insert("insert into user(phone,status) values(#{phone},#{status})")
    void save(User user);

    @Select("select * from user where id =#{id}")
    User findById(Long userId);
}
